package cn.websocket;


import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.context.ConfigurableApplicationContext;

import java.util.Optional;

/**
 * @author yexi
 */
@SpringBootApplication
@Slf4j
public class WebsocketServerApplication {
    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(WebsocketServerApplication.class, args);
        Integer port = Optional.ofNullable(context.getBean(ServerProperties.class).getPort()).orElse(8080);
        log.info("服务已启动，测试地址：http://localhost:{}/index.html", port);
    }
}
